load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "variable",
    srcs = [
        "error.go",
        "mock_globalaccessor.go",
        "noop.go",
        "removed.go",
        "sequence_state.go",
        "session.go",
        "setvar_affect.go",
        "slow_log.go",
        "statusvar.go",
        "sysvar.go",
        "tidb_vars.go",
        "variable.go",
        "varsutil.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/sessionctx/variable",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/config",
        "//pkg/config/kerneltype",
        "//pkg/errno",
        "//pkg/executor/join/joinversion",
        "//pkg/infoschema/issyncer/mdldef",
        "//pkg/keyspace",
        "//pkg/kv",
        "//pkg/meta/model",
        "//pkg/metrics",
        "//pkg/parser",
        "//pkg/parser/ast",
        "//pkg/parser/auth",
        "//pkg/parser/charset",
        "//pkg/parser/mysql",
        "//pkg/parser/terror",
        "//pkg/parser/types",
        "//pkg/planner/util/fixcontrol",
        "//pkg/privilege/privileges/ldap",
        "//pkg/resourcegroup",
        "//pkg/sessionctx/sessionstates",
        "//pkg/sessionctx/slowlogrule",
        "//pkg/sessionctx/stmtctx",
        "//pkg/sessionctx/vardef",
        "//pkg/types",
        "//pkg/types/parser_driver",
        "//pkg/util",
        "//pkg/util/chunk",
        "//pkg/util/collate",
        "//pkg/util/context",
        "//pkg/util/dbterror",
        "//pkg/util/dbterror/plannererrors",
        "//pkg/util/disk",
        "//pkg/util/execdetails",
        "//pkg/util/gctuner",
        "//pkg/util/intest",
        "//pkg/util/kvcache",
        "//pkg/util/logutil",
        "//pkg/util/mathutil",
        "//pkg/util/memory",
        "//pkg/util/naming",
        "//pkg/util/ppcpuusage",
        "//pkg/util/redact",
        "//pkg/util/replayer",
        "//pkg/util/rowcodec",
        "//pkg/util/sqlkiller",
        "//pkg/util/stmtsummary",
        "//pkg/util/stmtsummary/v2:stmtsummary",
        "//pkg/util/stringutil",
        "//pkg/util/tableutil",
        "//pkg/util/tiflash",
        "//pkg/util/tiflashcompute",
        "//pkg/util/tikvutil",
        "//pkg/util/timeutil",
        "//pkg/util/tls",
        "//pkg/util/topsql/state",
        "//pkg/util/traceevent",
        "//pkg/util/versioninfo",
        "@com_github_docker_go_units//:go-units",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/kvrpcpb",
        "@com_github_pingcap_tipb//go-tipb",
        "@com_github_tikv_client_go_v2//config",
        "@com_github_tikv_client_go_v2//kv",
        "@com_github_tikv_client_go_v2//oracle",
        "@com_github_tikv_client_go_v2//oracle/oracles",
        "@com_github_tikv_client_go_v2//tikv",
        "@com_github_tikv_client_go_v2//util",
        "@com_github_twmb_murmur3//:murmur3",
        "@org_golang_x_exp//maps",
        "@org_golang_x_time//rate",
        "@org_uber_go_atomic//:atomic",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "variable_test",
    timeout = "short",
    srcs = [
        "main_test.go",
        "mock_globalaccessor_test.go",
        "removed_test.go",
        "session_test.go",
        "slow_log_test.go",
        "statusvar_test.go",
        "sysvar_test.go",
        "variable_test.go",
        "varsutil_test.go",
    ],
    embed = [":variable"],
    flaky = True,
    shard_count = 50,
    deps = [
        "//pkg/config",
        "//pkg/config/kerneltype",
        "//pkg/executor",
        "//pkg/executor/join/joinversion",
        "//pkg/kv",
        "//pkg/parser",
        "//pkg/parser/auth",
        "//pkg/parser/mysql",
        "//pkg/parser/terror",
        "//pkg/planner/core",
        "//pkg/sessionctx",
        "//pkg/sessionctx/sessionstates",
        "//pkg/sessionctx/slowlogrule",
        "//pkg/sessionctx/stmtctx",
        "//pkg/sessionctx/vardef",
        "//pkg/testkit",
        "//pkg/testkit/testsetup",
        "//pkg/types",
        "//pkg/util",
        "//pkg/util/chunk",
        "//pkg/util/execdetails",
        "//pkg/util/gctuner",
        "//pkg/util/memory",
        "//pkg/util/mock",
        "//pkg/util/timeutil",
        "//pkg/util/traceevent",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//util",
        "@io_opencensus_go//stats/view",
        "@org_uber_go_goleak//:goleak",
    ],
)
